package Text3;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
//        给定一个长度为 n 的数列，请你求出数列中每个数的二进制表示中 1
//        的个数。
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i]=scanner.nextInt();
        }
        func(arr);
    }

    private static void func(int[] arr) {

        for (int i = 0; i < arr.length; i++) {
            int count=0;
            while (arr[i]>0){
                arr[i]=arr[i]&(arr[i]-1);
                count++;
            }
            System.out.print(count+" ");
        }
    }
}
